package com.d0324;

import java.util.Arrays;

public class TestSort {
    public static void main(String[] args) {
        Product p1=new Product("巧克力",45,1);
        Product p2=new Product("教材",25,5);
        Product p3=new Product("衣服",450,10);
        Product p4=new Product("手机",3045,2);
        Product[]pros=new Product[]{p1,p2,p3,p4};
        Arrays.sort(pros);
        //增强for循环
        for (Product p:
                pros) {
            System.out.println(p);
        }


       /* for (int i = 0; i <pros.length ; i++) {
            System.out.println(pros[i]);
        }*/
    }
}